#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int arr[55];
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }
    int digit;
    scanf("%d", &digit);
    for (int i = 0; i < n; i++) {
        if (arr[i] == digit) {
            for (int j = i; j < n; j++) {
                arr[j] = arr[j + 1];
            }
            n--;
            i--;
        }
    }
    for (int i = 0; i < n; i++) {
        printf("%d ", arr[i]);
    }
    return 0;
}